package com.lijing.service;

import com.lijing.dao.UserDao;
import com.lijing.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "UserService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User getUser(Integer uid) {
        return userDao.getUser(uid);
    }

    @Override
    public User getUserByUsername(String username) {
        return userDao.getUserByUsername(username);
    }

    @Override
    public void update(User user) {
        userDao.updateUser(user);
    }

    @Override
    public void deleteUser(Integer uid) {
        userDao.deleteUser(uid);
    }

    @Override
    public void register(User user) {
        userDao.addUser(user);
    }

    @Override
    public User login(String username, String password) {
        return userDao.selectUser(username, password);
    }

    @Override
    public void removeMember(User user) {
        userDao.removeMember(user);
    }
}
